package fun.lifepoem.blog.controller.base;

import fun.lifepoem.blog.common.ResponseConstant;
import fun.lifepoem.blog.common.RestResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Yiwyn
 * @create 2022/9/25 0:20
 */
public class BaseController {

    protected static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(BaseController.class);

    public static <T> RestResponse<T> doError(String message) {
        return new RestResponse<>(ResponseConstant.ERROR.getCode(), message, null);
    }

    public static <T> RestResponse<T> doSuccess(String message, T data) {
        return new RestResponse<>(ResponseConstant.SUCCESSE.getCode(), message, data);
    }

    public static <T> RestResponse<T> doSuccess(T data) {
        return new RestResponse<>(ResponseConstant.SUCCESSE.getCode(), "获取成功", data);
    }

}
